<template>
  <div>
    <div class="card-wrap flex-column justify-end card-padding">
      <div class="card-title-wrap">
        <span>基础信息</span>
        <span></span>
      </div>
      <el-form :model="form" ref="form" label-width="150px">
        <div class="box">
          <el-descriptions title="客户信息">
          </el-descriptions>
          <el-row>
            <el-col :span="8">
              <el-form-item label="客户名称:">
                <span>{{ form.customUserName }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="业务来源:">
                <span>{{ form.source }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="客户等级:">
                <dict-tag :options="dict.type.customer_level" :value="form.customGrade" />
              </el-form-item>
            </el-col>
          </el-row>
          <el-row>
            <el-col :span="8">
              <el-form-item label="销售（合同发起人）:">
                <span>{{ form.saleUserName }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="申请时间:">
                <span>{{ form.applyTime }}</span>
              </el-form-item>
            </el-col>
          </el-row>
        </div>

        <div class="box">
          <el-descriptions title="订单信息">
          </el-descriptions>
          <el-row>
            <el-col :span="8">
              <el-form-item label="外采方式:">
                <dict-tag :options="dict.type.quota_outsourcing" :value="form.outsourcingType" />
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="合同编号:">
                <span style="cursor: pointer; color: #1890ff;" @click="getOrderParam(form.orderCode)">{{ form.contractNo }}</span>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="订单编号:">
                <span style="cursor: pointer; color: #1890ff;" @click="getOrderParam(form.orderCode)">{{ form.orderCode }}</span>
              </el-form-item>
            </el-col>
            <!-- <el-col :span="8">
              <el-form-item label="采购类型:">
                <span>{{ form.procureType }}</span>
              </el-form-item>
            </el-col> -->
          </el-row>
        </div>
      </el-form>
    </div>
  </div>
</template>

  <script>
import { OrderParam } from '@/api/finance/manage/collect/api.js';
export default {
  name: "carModel",
  dicts: ["customer_level", "quota_outsourcing"],
  props: {
    value: {
      type: Object,
      default: {},
    },
  },
  computed: {
    form: {
      get() {
        let that = this;
        const proxy = new Proxy(that.value, {
          get(target, key) {
            return Reflect.get(target, key);
          },
          set(target, key, value) {
            that.$emit("input", { ...target, [key]: value });
            return true;
          },
        });
        return proxy;
      },
    },
  },
  data() {
    return {};
  },
  methods: {
    /**
     *订单详情
     */
    getOrderParam(orderCode) {
      orderCode && OrderParam(orderCode).then(res => {
        if (res.code == 200 && this.notEmpty(res.data)) {
          this._toPage({
            name: 'OrderDetails',
            query: {
              type: res.data.carType,
              orderId: res.data.orderId,
              calcSchemeId: res.data.calcSchemeId,
            },
          })
        }
      })
    },
  },
};
</script>

<style lang="scss" scoped>
.app-container {
  background-color: #fff;
}
.box {
  width: 100%;
  .title {
    border-left: 3px solid #3280fc;
    padding-left: 5px;
    box-sizing: border-box;
  }
  .content {
    width: 90%;
    margin: 0 auto;
  }
}
</style>
